<%@page import="fr.insta.reverse.uml.routing.Route"%>
<%@page contentType="text/html; charset=UTF-8"%>
<%@page pageEncoding="UTF-8"%>

<%
	Route[] indexRoutes = new Route[]{Route.Accueil, Route.ProjectCreate, Route.ProjectList, Route.ProjectSearch};
	String[] labels = new String[]{"ACCUEIL", "CRÉER / UPLOADER UN PROJET", "LISTE DES PROJETS", "RECHERCHER UN PROJET"};

	boolean isConnected = session != null && session.getAttribute("User") != null;

	Route routeUser = isConnected ? Route.UserDeconnection : Route.UserInscription;
	String labelRoute = isConnected ? "DÉCONNEXION" : "INSCRIPTION";
%>


<div id="menu">
	<ul>

	<% 
		int i= 0;
		for(Route route: indexRoutes){
	%>
			<li>
				<a	href="<%=route.getAbsoluteRoute(request) %>"
					<%=route.getRoute().compareTo(request.getAttribute("route").toString()) == 0 ? "class='current'" : "" %>
					>
					<%=labels[i]%>
				</a>
			</li>
	<% 
		i++;
		}%>
		<li>
			<a href="<%=routeUser.getAbsoluteRoute(request) %>"
				<%=routeUser.getRoute().compareTo(request.getAttribute("route").toString()) == 0 ? "class='current'" : "" %>
				>
				<%= labelRoute %>
			</a>
		</li>
	</ul>
</div>